<template>
	<view class="home">
		<navbar :isback='false' title="达人商单" backgroundColor='rgba(248, 248, 253, 1)'>
			<view slot="left" class="hleft">
				<!-- <image class="gllogo" src="/static/LOGO.png" /> -->
			</view>
		</navbar>
		<!-- #ifdef APP-PLUS -->
		<!-- <view class="immerse"></view> -->
		<!-- #endif -->
		<view class="newcontent">
			<view class="hone">
				<image class="bg" src="/static/bg.png" mode="" />
				<view class="honeitem">
					<view class="htui">
						推荐达人商单协作平台
					</view>
				</view>
			</view>
			<image class="xianicon" src="/static/xian.png" mode="" />
			<view class="daone">
				<text class="daname">达人商单</text>
				<text class="damiao">从派单到结算，清晰不忙乱</text>
				<view class="daoitem">
					<view class="items">
						<image class="boicon" src="/static/boicon.png" mode="" />
						<text>直播</text>
					</view>
					<view class="items iactive">
						<image class="boicon" src="/static/btwo.png" mode="" />
						<text>探店</text>
					</view>
					<view class="items">
						<image class="boicon" src="/static/yunjian.png" mode="" />
						<text>云剪</text>
					</view>
				</view>
				<view class="shangdan"  @click="getpaidan">
					<view class="shangbtn">商家派单</view>
					<view class="mianfei">全程免费</view>
				</view>
				<view class="shangdan shangdantwo" @click="getdaren">
					<view class="shangbtn">达人接单</view>
					<view class="mianfei">没有广告</view>
				</view>
				<view class="tyi">
					<view class="gous" v-if="!checked" @click="checked = !checked"></view>
					<image class="dui" style="pointer-events: auto !important;" src="/static/dui.png" v-if="checked" mode="" @click="checked = !checked" />
					<text class="tname">我已同意<text class="xie">用户协议</text>和<text class="xie">隐私政策</text></text>
				</view>
			</view>

			<view class="botshang">
				<image class="botxian" src="/static/tabbar-bgtwo.png" mode="" />
				<view class="tianse"></view>
				<view class="botview">
					<view class="shopview">
						<image class="fang" src="/static/fang.png" mode="" />
					</view>
					<text class="shopname">达人商单微信小程序版</text>
					<text class="shopbanben">v3.6.27</text>
				</view>
			</view>
		</view>
</view>
</template>

<script>
export default {
	data() {
		return {
			bgcolor:'#fff',
			checked:true
		}
	},
	components: {
	},
	computed: {
	},

	mounted() {
		
	},
	async onLoad() {
		// 3077306a-69f8-476f-bd92-e7b6638d1708
		uni.setStorageSync('token','3077306a-69f8-476f-bd92-e7b6638d1708')
		uni.setStorageSync('uid','13')
		this.onLoginClick()
	},
	async onShow() {
		
	},
	onReachBottom: function () {
	},
	methods: {
		getdaren(){
			uni.reLaunch({ url:"/pages/tabbar/Home" })
		},
		getpaidan(){
			uni.reLaunch({ url:"/pages/tabbar/Pai" })
		},
		onLoginClick() {
				if (!this.checked) {
					this.$u.toast("请先阅读并同意隐私协议")
					return
				}
				uni.login({
					provider: 'weixin',
					timeout: 3000,
					success: res => {
						if (res.code) {
							uni.getUserInfo({
								success: sres => {
									console.log(sres)
									this.login(res.code, sres.encryptedData, sres.iv)
								},
								fail: () => {
									this.$u.toast("请求失败")
								}
							})
						}
					},
					fail: () => {
						this.$u.toast("请求失败")
					}
				})

			},
			async login(code, encryptedData, iv) {
				console.log(code)
				let res = await this.$u.api.miniapplogin({
					logincode: code,
					// iv: iv,
					// encryptedData: encryptedData,
				});
				console.log(res)
				// this.$api.login({
				// 	code: code,
				// 	iv: iv,
				// 	encryptedData: encryptedData,
				// }).then((res) => {
				// 	uni.$u.toast("登录成功")
				// 	uni.setStorageSync("user_info_token", res.userinfo.token);
				// 	uni.setStorageSync("user_info_id", res.userinfo.id);
				// 	uni.setStorageSync("user_info", res.userinfo);
				// 	this.$emit("saveUserInfo", {
				// 		code: 200
				// 	})
				// 	this.$refs.auth.close();
				// }).catch((e) => {
				// 	uni.$u.toast(e.msg === undefined ? "登录失败" : e.msg)
				// })
			},

	}
}
</script>

<style lang="scss" scoped>
.newcontent{
	// min-height: 100vh;
	padding-bottom: 150px;
	background-color:  #f8f8fd;
	.hone{
		margin: 0 40rpx 40rpx;
		height: 180rpx;
		opacity: 1;
		border-radius: 24rpx;
		position: relative;
		.bg{
			position: absolute;
			width: 100%;
			height: 100%;
			border-radius: 24rpx;
		}
		.honeitem{
			position: relative;
			height: 100%;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			.htui{
				width: 188px;
				height: 36px;
				opacity: 1;
				border-radius: 50px;
				background: rgba(255, 255, 255, 0.63);
				box-shadow: 0px 6px 10px  rgba(119, 102, 231, 0.08);
				font-size: 14px;
				font-weight: 400;
				color: rgba(1, 117, 255, 1);
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 7%;

			}
		}
	}
	.xianicon{
		margin: 0px auto;
		width: 92%;
		height: 1px;
		display: block;
	}
	.daone{
		display: flex;
		flex-direction: column;
		align-items: center;
		margin: 40rpx 0;
		padding: 0 30rpx;
		.daname{
			font-size: 65rpx;
			font-weight: 500;
			color: rgba(51, 51, 51, 1);
		}
		.damiao{
			font-size: 30rpx;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
			display: block;
			margin: 10rpx 0 0;
		}
		.daoitem{
			display: flex;
			flex-direction: row;
			margin-top: 40rpx;
			justify-content: space-between;
			width: 100%;
			margin-bottom: 40rpx;
			.items{
				width: 31%;
				height: 210rpx;
				opacity: 1;
				border-radius: 12px;
				background: rgba(255, 255, 255, 1);
				box-shadow: 0px 6px 10px  rgba(119, 102, 231, 0.08);
				display: flex;
				align-items: center;
				justify-content: center;
				flex-direction: column;
				text{
					font-size: 28rpx;
					font-weight: 400;
					color: rgba(51, 51, 51, 1);
					display: block;
					margin-top: 20rpx;
				}
				.boicon{
					width: 36px;
					height: 36px;
				}
			}
			.iactive{
				border: 4rpx solid rgba(119, 102, 231, 1);
				box-shadow: 0rpx 0rpx 12rpx  rgba(119, 102, 231, 0.36);
			}
		}
		.shangdan{
			width: 540rpx;
			height: 100rpx;
			opacity: 1;
			border-radius: 50px;
			position: relative;
			background: linear-gradient(90deg, rgba(119, 102, 231, 1) 0%, rgba(121, 72, 234, 1) 100%);
			box-shadow: 0px 0px 3px  rgba(119, 102, 231, 0.63);
			margin-bottom: 20rpx;
			.shangbtn{
				position: relative;
				width: 100%;
				height: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 18px;
				font-weight: 700;
				color: rgba(255, 255, 255, 1);
			}
			.mianfei{
				width: 50px;
				height: 21px;
				border-radius: 3px;
				background: rgba(255, 255, 255, 1);
				box-shadow: 0px 0px 3px  rgba(119, 102, 231, 0.63);
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 10px;
				font-weight: 400;
				color: rgba(119, 102, 231, 1);
				position: absolute;
				right: 0;
				top: -6px;
			}
		}
		.shangdantwo{
			background: rgba(255, 255, 255, 1);
			box-shadow: 0px 0px 3px  rgba(119, 102, 231, 0.63);
			.shangbtn{
				color: rgba(119, 102, 231, 1);
			}
			.mianfei{
				background: rgba(119, 102, 231, 1);
				color: #fff;
				box-shadow: 0px 0px 3px  rgba(119, 102, 231, 0.63);
			}
		}
	}
	.tyi{
		display: flex;
		flex-direction: row;
		align-items: center;
		.tname{
			font-size: 12px;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
			display: inline-block;
			margin-left: 10rpx;
		}
		.xie{
			text-decoration: underline;
			display: inline-block;
			margin: 0 5rpx;
		}
		.dui{
			width: 18px;
			height: 18px;
		}
		.gous{
			width: 18px;
			height: 18px;
			border: 1px solid #eee;
		}
	}
	.botshang{
		height: 122px;
		position: fixed;
		width: 100%;
		bottom: 0;
		margin-top: 20px;
		.botxian{
			position: absolute;
			width: 100%;
			height: 50px;
			top: 0;
		}
		.tianse{
			height: 72px;
			position: absolute;
			width: 100%;
			background-color: #fff;
			bottom: 0;
		}
		.botview{
			position: relative;
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			.shopview{
				position: relative;
				width: 60px;
				height: 60px;
				opacity: 1;
				border-radius: 12px;
				background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(248, 248, 253, 1) 100%);
				box-shadow: 0px 0px 3px  rgba(119, 102, 231, 0.63);
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: -54rpx;
				.fang{
					width: 40px;
					height: 40px;
				}
			}
			.shopname{
				font-size: 12px;
				font-weight: 400;
				display: block;
				margin-top: 20px;
				color: rgba(153, 153, 153, 1);
			}
			.shopbanben{
				font-size: 12px;
				font-weight: 400;
				margin-top: 2px;
				color: rgba(153, 153, 153, 1);
			}
		}
	}
	
}	
</style>
